﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        private ProgramStep m_status = ProgramStep.Initializing;


        public Window1()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Status = ProgramStep.Idle;
        }

        private ProgramStep Status
        {
            get { return m_status; }
            set
            {
                if (m_status != value)
                {
                    m_status = value;

                    switch (m_status)
                    {
                        case ProgramStep.Initializing:
                            break;
                        case ProgramStep.Idle:
                            StartPages.Start start = new StartPages.Start();
                            start.Next += new EventHandler(start_Next);
                            MainContent.Content = start;
                            break;
                        case ProgramStep.Game:
                            break;
                        case ProgramStep.GameOver:
                            break;
                        default:
                            break;
                    }
                }
            }
        }

        private void start_Next(object sender, EventArgs e)
        {
            (sender as StartPages.IIdleScreen).Next -= new EventHandler(start_Next);
            StartPages.HighScoreScreen hs = new WpfApplication1.StartPages.HighScoreScreen();
            hs.Next += new EventHandler(hs_Next);
            MainContent.Content = hs;
        }

        void hs_Next(object sender, EventArgs e)
        {
            (sender as StartPages.IIdleScreen).Next -= new EventHandler(hs_Next);
            StartPages.Start start = new StartPages.Start();
            start.Next += new EventHandler(start_Next);
            MainContent.Content = start;
        }

        private void Window_StateChanged(object sender, EventArgs e)
        {
            switch (WindowState)
            {
                case WindowState.Maximized:
                    WindowStyle = WindowStyle.None;
                    //Topmost = true;
                    break;
                case WindowState.Minimized:
                case WindowState.Normal:
                    WindowStyle = WindowStyle.SingleBorderWindow;
                    break;
                default:
                    break;
            }
        }

    }


    public enum ProgramStep
    {
        Initializing,
        Idle,
        Game,
        GameOver
    }

}
